<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, shrink-to-fit=no"
          name="viewport">
    <title>反馈管理-爱慈善</title>

    <link rel="stylesheet" href="background/modules/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="background/modules/ionicons/css/ionicons.min.css">
    <link rel="stylesheet" href="background/modules/fontawesome/web-fonts-with-css/css/fontawesome-all.min.css">

    <link rel="stylesheet" href="background/modules/summernote/summernote-lite.css">
    <link rel="stylesheet" href="background/modules/flag-icon-css/css/flag-icon.min.css">
    <link rel="stylesheet" href="background/css/demo.css">
    <link rel="stylesheet" href="background/css/style.css">
    <link rel="stylesheet" href="background/css/common.css"/>
    <link rel="stylesheet" href="common/datatable/dataTables.bootstrap4.min.css"/>
</head>

<body>
<div id="app">
    <div class="main-wrapper">
        <div class="navbar-bg"></div>

        <div th:replace="commons/admin-bar::navbar(currUri='admin-feedback')"></div>
        <div th:replace="commons/admin-bar::sidebar(currUri='admin-feedback')"></div>
        <div class="main-content">
            <section class="section">
                <h1 class="section-header">
                    <div><i class="icon ion ion-android-drafts"></i> 反馈管理</div>
                </h1>
                <div class="row">
                    <div class="col-xs-12 col-sm-12 col-md-12">
                        <div class="card mb-3">
                            <div class="card-body">
                                <div class="table-responsive">
                                    <table id="example1" class="table table-bordered table-hover display"
                                           style="text-align: center">
                                        <thead>
                                        <tr>
                                            <th>序号</th>
                                            <th>昵称</th>
                                            <th>邮箱</th>
                                            <th style="width: 40%">反馈</th>
                                            <th>时间</th>
                                            <th>操作</th>
                                        </tr>
                                        </thead>
                                        <tbody style="font-size: 13px">
                                        <tr th:each="feedbackVo,feedbackStat:${feedbackVos}">
                                            <td th:text="${feedbackStat.index +1}"></td>
                                            <td th:text="${feedbackVo.user.name}"></td>
                                            <td th:text="${feedbackVo.user.email}"></td>
                                            <td th:text="${feedbackVo.feedback.content}"></td>
                                            <td th:text="${#dates.format(feedbackVo.feedback.gmtCreate,'yyyy-MM-dd HH:mm:ss')}"></td>
                                            <td>
                                                <button th:onclick="deleteFeedBack([[${feedbackVo.feedback.id}]])"
                                                        class="btn btn-sm btn-outline-danger">删除
                                                </button>
                                            </td>
                                        </tr>
                                        </tbody>
                                        <thead>
                                        </thead>
                                    </table>
                                </div>

                            </div>
                        </div><!-- end card-->
                    </div>
                </div>

            </section>
        </div>
        <div th:replace="commons/admin-bar::footer"></div>
    </div>
</div>
<script src="background/modules/jquery.min.js"></script>
<script src="background/modules/popper.js"></script>
<script src="background/modules/tooltip.js"></script>
<script src="background/modules/bootstrap/js/bootstrap.min.js"></script>
<script src="background/modules/nicescroll/jquery.nicescroll.min.js"></script>
<script src="background/modules/scroll-up-bar/dist/scroll-up-bar.min.js"></script>
<script src="background/js/sa-functions.js"></script>

<script src="background/modules/chart.min.js"></script>
<script src="background/modules/summernote/summernote-lite.js"></script>

<script src="background/js/scripts.js"></script>
<script src="background/js/custom.js"></script>
<script src="common/datatable/jquery.dataTables.min.js"></script>
<script src="common/datatable/dataTables.bootstrap4.min.js"></script>
<script src="common/js/board.js"></script>
<script>
    // START CODE FOR BASIC DATA TABLE
    $(document).ready(function () {
        $('#example1').DataTable({
            language: {
                "sProcessing": "处理中...",
                "sLengthMenu": "显示 _MENU_ 项结果",
                "sZeroRecords": "没有匹配结果",
                "sInfo": "显示第 _START_ 至 _END_ 项结果，共 _TOTAL_ 项",
                "sInfoEmpty": "显示第 0 至 0 项结果，共 0 项",
                "sInfoFiltered": "(由 _MAX_ 项结果过滤)",
                "sInfoPostFix": "",
                "sSearch": "搜索:",
                "sUrl": "",
                "sEmptyTable": "表中数据为空",
                "sLoadingRecords": "载入中...",
                "sInfoThousands": ",",
                "oPaginate": {
                    "sFirst": "首页",
                    "sPrevious": "上页",
                    "sNext": "下页",
                    "sLast": "末页"
                },
                "oAria": {
                    "sSortAscending": ": 以升序排列此列",
                    "sSortDescending": ": 以降序排列此列"
                }
            },
            "aoColumnDefs": [{"bSortable": false, "aTargets": [1, 2, 3, 5]}],
            "order": [4, "desc"]
        });
    });
    // END CODE FOR BASIC DATA TABLE


    // START CODE FOR Child rows (show extra / detailed information) DATA TABLE
    /**
     * 删除留言
     * @param id
     */
    function deleteFeedBack(id) {
        $.ajax({
            type: "GET",
            url: "deleteFeedBack",
            data: {id: id},
            dataType: "json",
            success: function (data) {
                if (data.code== 200) {
                    alert("删除成功！");
                    window.location.reload();
                } else {
                    alert("服务器发生了一个错误");
                }
            }
        });
    }
</script>

</body>
</html>
